package ms.platform.system.service;

import ms.platform.system.dao.ManufacturerDAO;
import ms.platform.system.model.Manufacturer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional(propagation = Propagation.SUPPORTS)
public class ManufacturerService {

    @Autowired
    private ManufacturerDAO manufacturerDAO;

    /**
     * 获取所有厂商
     *
     * @return
     */
    public List<Manufacturer> getAllManufacturer(Map<String, Object> map) {
        return manufacturerDAO.getAllManufacturer(map);
    }

    public List<Manufacturer> searchManufacturer(Manufacturer manufacturer) {
        return manufacturerDAO.searchManufacturer(manufacturer);
    }

    /**
     * add
     *
     * @return
     */
    public void insertManufacturer(Manufacturer manufacturer) {
        manufacturerDAO.insertManufacturer(manufacturer);
    }

    /**
     * 获取
     *
     * @return
     */
    public Manufacturer getManufacturer(Integer id) {
        return manufacturerDAO.getManufacturer(id);
    }

    /**
     * 获取
     *
     * @return
     */
    public Manufacturer getManufacturerName(String orgName) {
        return manufacturerDAO.getManufacturerName(orgName);
    }

    /**
     * add
     *
     * @return
     */
    public void updateManufacturer(Manufacturer manufacturer) {
        manufacturerDAO.updateManufacturer(manufacturer);
    }

    /**
     * del
     *
     * @return
     */
    public void deleteManufacturer(Integer id) {
        manufacturerDAO.deleteManufacturer(id);
    }

    //获取总数
    public Integer queryManufacturerCount(Map<String, Object> map) {
        return manufacturerDAO.queryManufacturerCount(map);
    }
}
